package com.lufei.dh.ExList.Adapter;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.lufei.dh.ExList.Bean.Level0Item;
import com.lufei.dh.R;

import java.util.List;

/**
 * 版权：易金卡沃 版权所有
 * <p>
 * 作者：lufeifei
 * <p>
 * 创建日期：2018/6/9
 * <p>
 * 描述：
 * <p>
 * 修订历史：
 */
public class Adapter_ExList extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public Adapter_ExList(List<MultiItemEntity> data) {
        super(data);
        addItemType(0, R.layout.item_0);
        addItemType(1, R.layout.item_1);
    }

    @Override
    protected void convert(BaseViewHolder helper, MultiItemEntity item) {
        switch (helper.getItemViewType()) {
            case 0:
                Level0Item level0Item = (Level0Item) item;
                helper.setText(R.id.id_item0_text, level0Item.getName())
                        .setImageResource(R.id.id_item0_image, level0Item.isExpanded() ? R.mipmap.arrow_b : R.mipmap.arrow_r);
                break;
            case 1:

                break;
        }
    }
}
